home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / ThreadStuff / ThreadUtilities.h < prev   
Encoding:
C/C++ Source or Header  |  1995-07-28  |  2.2 KB  |  65 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ThreadUtilities.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef    __THREADUTILITIES__
  15. #define    __THREADUTILITIES__
  16.  
  17. #ifndef    THREAD_H
  18. // #include "Thread.h"
  19. #endif
  20.  
  21. #ifndef    __NEWDELETE__
  22. #include "NewDelete.h"
  23. #endif
  24.  
  25. extern Boolean BreakOnFailures();
  26.  
  27. #if 0
  28.  
  29.  
  30. #if defined ( debug ) || defined ( BLJTestTool )
  31.  
  32.     //    This definitions override those in Thread.h and output the 'reason'
  33.     //    that the exception was called to the keith output stream.
  34.         
  35.     #undef EXCEPTION
  36.     #undef RETRY
  37.     #undef FAIL
  38.     #undef PASSEXCEPTION
  39.     #undef FAILOSErr
  40.     #undef FAILNULL
  41.     #undef FAILifTRUE
  42.     #undef FAILifFALSE
  43.     
  44.     #define EXCEPTION                         _premoveExceptionHdlr(&__fr);}else{keith<<"EXCEPTN : #"<<EXCEPTIONCODE<<" file "<<__FILE__<<", line "<<__LINE__<<endl;
  45.     #define RETRY()                            {keith<<"RETRY   : file " __FILE__ ", line "<<__LINE__<<endl;_retry(&__fr);}
  46.     #define FAIL(code)                        {keith<<"FAIL    : #"<<code<<", file "<<__FILE__<<", line "<<__LINE__<<endl; if (BreakOnFailures()) BreakStr ("\pFAILURE"); _praiseException(code);}
  47.     #define PASSEXCEPTION()                    {keith<<"PASSEXCP: #"<<EXCEPTIONCODE<<", file "<<__FILE__<<", line "<<__LINE__<<endl;_praiseException(EXCEPTIONCODE);}
  48.     #define FAILOSErr(code)                 {OSErr FAILOSERRCODE=code;if(FAILOSERRCODE){keith << "FAIL/OS : #"<<FAILOSERRCODE<<", file "<<__FILE__<<", line "<<__LINE__<<endl; if (BreakOnFailures()) BreakStr ("\pFAILURE"); _failoserr(FAILOSERRCODE);}}
  49.     #define FAILNULL(p)                     if(!p){keith<<"FAILNULL: file "<<__FILE__<<", line "<<__LINE__<<endl; if (BreakOnFailures()) BreakStr ("\pFAILURE"); _failnull(p);}
  50.     #define FAILifTRUE(p)                     if(p){keith<<"FAILTRUE: file "<<__FILE__<<", line "<<__LINE__<<endl; if (BreakOnFailures()) BreakStr ("\pFAILURE"); _failoserr(-1);}
  51.     #define FAILifFALSE(p)                     if(!p){keith<<"FAILFALS: file "<<__FILE__<<", line "<<__LINE__<<endl; if (BreakOnFailures()) BreakStr ("\pFAILURE"); _failoserr(-1);}
  52.     
  53. #else
  54.  
  55.     #define FAILifTRUE(p)                     if(p)_failoserr(-1)
  56.     #define FAILifFALSE(p)                     if(!p)_failoserr(-1)
  57.  
  58. #endif    // !(debug || BLJTestTool)
  59.  
  60. #endif
  61.  
  62.  
  63. #endif    // __THREADUTILITIES__
  64.  
  65.